package com.dm.util;

import java.util.Calendar;

import com.dm.bean.Schedule;

public class Constant {

    public final static int DIALOG_SET_SEARCH_RANGE = 1;// 設置搜索日期範圍對話框
    public final static int DIALOG_SET_DATETIME = 2;// 設置日期時間對話框
    public final static int DIALOG_SCH_DEL_CONFIRM = 3;// 日程刪除確認
    public final static int DIALOG_SCH_SYNC_CONFIRM = 4;// 日程同步確認
    public final static int DIALOG_ALL_DEL_CONFIRM = 5;// 刪除全部過期日程
    public final static int DIALOG_DEL_TYPE = 7;// 類別刪除

    public static enum WhoCall {// 判斷誰調用了dialogSetRange，以決定哪個控件該gone或者visible
	SETTING_ALARM, // 表示設置鬧鐘按鈕
	SETTING_DATE, // 表示設置日期按鈕
	SETTING_RANGE, // 表示設置日程查找範圍按鈕
	NEW, // 表示新建日程按鈕
	EDIT, // 表示修改日程按鈕
	SEARCH_RESULT// 表示查找按鈕
    }

    public static enum Layout {
	MAIN, // 主界面
	SETTING, // 日程設置
	TYPE_MANAGER, // 類型管理
	SEARCH, // 查找
	SEARCH_RESULT, // 查找結果界面
    }

    public static String getNowDateString()// 獲得當前日期方法並轉換格式YYYY/MM/DD
    {
	Calendar c = Calendar.getInstance();
	int nowy = c.get(Calendar.YEAR);
	int nowm = c.get(Calendar.MONTH) + 1;
	int nowd = c.get(Calendar.DAY_OF_MONTH);
	String nowDate = Schedule.toDateString(nowy, nowm, nowd);
	return nowDate;
    }

    public static String getNowTimeString()// 獲得當前時間，並轉換成格式HH:MM
    {
	Calendar c = Calendar.getInstance();
	int nowh = c.get(Calendar.HOUR_OF_DAY);
	int nowm = c.get(Calendar.MINUTE);
	String nowTime = Schedule.toTimeString(nowh, nowm);
	return nowTime;
    }
}
